﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PPCodes.ToolBoxPad
{
    public partial class NewCategory : Form
    {
        public NewCategory()
        {
            InitializeComponent();
        }

        public NewCategory(ConfigureToolBox ctb)
        {
            InitializeComponent();
            _ctb = ctb;
        }

        private ConfigureToolBox _ctb = null;


        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_ctb.AddNewCategoryAndRefresh(txtName.Text.Trim()))
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Exist the same name!");
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
